<% if(request.url.include? '/admin') %>
<!DOCTYPE html>
<html>
  <head>
    <title>后台管理系统 - <%=SITE_NAME%></title>
    <%= csrf_meta_tags %>
    <link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
    <link rel="stylesheet" href="/css/pagination.css" type="text/css" media="screen" charset="utf-8"/>
    <style type="text/css">
      body {
        padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
      }
    </style>
    <script src="/js/jquery.min.js"></script>
  </head>
  <body>
	<div class="navbar navbar-inverse navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container">
          <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </a>
          <a class="brand" href="/"><%=SITE_NAME%></a>
          <div class="nav-collapse collapse">
            <ul class="nav">
              <li><a href="/admin">后台首页</a></li>
              <li<%=raw navclass('/feedback')%>><a href="/admin/feedback">反馈管理</a></li>
              <li<%=raw navclass('/codeparter')%>><a href="/admin/codeparter">代码碎片</a></li>
              <li<%=raw navclass('/userlist')%>><a href="/admin/userlist">用户管理</a></li>
              <li<%=raw navclass('/memolist')%>><a href="/admin/memolist">便笺管理</a></li>
              <li class="dropdown" line="post">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">文档管理 <b class="caret"></b></a>
                <ul class="dropdown-menu">
                  <li><a href="/admin/doc">首页帖子推荐</a></li>
                  <li><a href="/admin/doclist">文章发布列表</a></li>
                </ul>
              </li>
              <li class="dropdown" line="adminer">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">权限控制 <b class="caret"></b></a>
                <ul class="dropdown-menu">
                  <li><a href="/adminers">管理员</a></li>
                  <li><a href="#">权限分配</a></li>
                </ul>
              </li>
              <% if(session[:adminer] != nil) %>
              <li><a href="#contact">个人资料</a></li>
              <li><a href="/admin/logout">退出系统</a></li>
              <% end %>
            </ul>
          </div><!--/.nav-collapse -->
        </div>
      </div>
    </div>

	<div class="container">

		<%= yield %>

      <hr/>
      <footer>
        <p>© Company 2012</p>
      </footer>
    </div>

    <script src="/bootstrap/js/bootstrap.min.js"></script>
    <script type="text/javascript">
    $().ready(function(){
      // 权限控制的导航样式
      if(location.href.toString().indexOf('categories') > 0 || location.href.toString().indexOf('posts') > 0 || location.href.toString().indexOf('/admin/doc') > 0)
        $('li[line=post]').addClass('active');
    });
    </script>
  </body>
</html>
<% elsif (curpath == 'user#index' || curpath == 'user#login' || curpath == 'user#reg' || curpath == 'doc#index' || curpath == 'doc#share2' || curpath == 'doc#new' || curpath == 'doc#show' || curpath == 'doc#showa' || curpath == 'memo#index' || curpath == 'suggestion#index' || curpath == 'suggestion#about' || curpath == 'suggestion#faq' || curpath == 'suggestion#privacy') %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
<html> 
  <head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <%= csrf_meta_tags %>
    <title><%=getTitle%></title> <%=raw(getKeywords)%> <%=raw(getDesc)%>
    <link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
    <link rel="stylesheet" href="/css/master.css" type="text/css" media="screen" charset="utf-8"/>
    <script src="/js/jquery.min.js"></script>
  </head> 
  <body> 
    <div id='wrapper'> 
      <div id='header'>
        <div class="container"> 
          <h1><a href="/">天天笔记</a></h1> 
          <h2>一款最好用的免费网络在线记事本</h2> 
          <% if(session[:user] == nil) %>
            <a href="/user/login/" class="login">登录</a>
          <% else %>
          <div class="user"><%=raw(CodeparterController.getByName 'newtip') %>
                当前用户：<%= session[:user].name%> &nbsp;
                <a href="/user/profile">修改密码</a>
                &nbsp;</div>
            <div style="float:right; margin-top:-35px;"><a href="/user/logout/" class="login">退出</a></div>
          <% end %>
        </div>
      </div>
      <%= yield %>
      <div id='footer'> 
        <div class="container">
        © 2012-2013 – <a href="/">天天笔记</a> - TTBIJI.com - Layout based on bootstrap.
        <br/><% if(curpath == 'user#index') %><%=raw(CodeparterController.getByName 'link') %><% end %>
        <ul>
          <li class="bug"><a href="/feedback/">用户反馈</a></li>
          <li><a href="/about/">关于本站</a></li>
          <li><a href="/faq/">常见问题</a></li>
          <li><a href="/privacy/">隐私政策</a></li>
          <li><a href="/sitemap.xml">站点地图</a></li>
          <li class="last"><a href="http://www.miitbeian.gov.cn/" target="_blank">豫ICP备13000858号-2</a></li>
        </div>
      </div>
    </div>
  </body> 
</html>
<% elsif(curpath == 'doc#test') %>
<%= yield %>
<% elsif(request.url.include? '/doc/cate') %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title><%=getTitle%></title> <%=raw(getKeywords)%> <%=raw(getDesc)%>
  <link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
  <%= csrf_meta_tags %>
  <script src="/js/jquery.min.js"></script>
  <script src="/bootstrap/js/bootstrap.min.js"></script>
  <link rel="shortcut icon" href="/favicon.ico" />
</head>

<body>
<div id="wrapper">
<%= yield %>
<div class="clear"></div>
</div>
<script type="text/javascript">
$().ready(function(){
  $.ajaxSetup({  
      beforeSend: function(xhr) {  
          xhr.setRequestHeader("X-CSRF-Token", $("meta[name=\"csrf-token\"]").attr("content"));  
      }  
  });
});
</script>
</body>
</html>
<% else %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title><%=getTitle%></title> <%=raw(getKeywords)%> <%=raw(getDesc)%>
  <link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
  <%= stylesheet_link_tag "application", 'scaffolds', "#{controller.controller_name}", :media => "all" %>
  <%= javascript_include_tag "application", "#{controller.controller_name}", :media => "all" %>
  <%= csrf_meta_tags %>
  <script src="/bootstrap/js/bootstrap.min.js"></script>
  <link rel="shortcut icon" href="/favicon.ico" />
  <style type="text/css">
  #nav a.newtip { color: #ccc; font-size: 12px; text-decoration: none; margin-right: 50px;}
  #nav a.newtip:hover { color: #fff; font-size: 12px; text-decoration: underline; }
  </style>
</head>

<body>
<div id="page_margin">

<div id="header">
	<b class="title">天天笔记</b>
	<span class="desc"><% if(curpath == 'user#login' || controller_name == 'doc') %>一款最好用的免费网络在线记事本<% else %>ttbiji.com | 网络记事本_在线电子记事本软件<% end %></span>
</div>

<div id="nav">
	<a href="/doc" class="<%=nav_class('doc')%>">文档</a>
	<a href="/memo" class="<%=nav_class('memo')%>">便笺</a>
	<a href="/rili" class="<%=nav_class('suggestion/rili')%>">日历</a>
	<a href="/feedback" class="<%=nav_class('suggestion/index')%>">反馈</a>
	<% if(session[:user] == nil) %>
	<a href="/user/login" class="<%=nav_class('user/login')%>">登录</a>
	<a href="/user/reg" class="<%=nav_class('user/reg')%>">注册</a>
	<% else %>
  
	<div class="user">
    <%=raw(CodeparterController.getByName 'newtip') %>
    当前用户：<%= session[:user].name%> &nbsp;
		<a href="/user/profile">修改密码</a>
		&nbsp;<a href="/user/logout">退出登录</a>
	</div>
	<% end %>
</div>

<%= yield %>

<div class="clear"></div>
<div id="footer">
	© 2012-2013 – <a href="/">天天笔记</a> - TTBIJI.com - Layout based on bootstrap.
	<br/><% if(showlinks) %><%=raw(CodeparterController.getByName 'link') %><% end %> <a href="/about">关于天天笔记</a>&nbsp;<a href="/sitemap.xml">站点地图</a>
</div>
</div>
</body>
</html>
<% end %>